const state = {
  parameterList: [],    // 参数数据集合
  parameterMap: new Map()
}

const getters = {
  parameterList: state => state.parameterList,
  parameterMap: state => state.parameterMap
}

const mutations = {
  setParameterList: (state, list) => {
    state.parameterList = list

    let map = new Map()
    list.forEach(element => {
      map.set(element.paramKey, element.value)
    })
    state.parameterMap = map
  }
}

const actions = {
  setParameterList: (context, list) => context.commit('setParameterList', list)
}

export default {
  state,
  getters,
  mutations,
  actions
}
